import java.util.Random;

/**
 *
 */
public class HouseHold {

    // 名字
    private String name;

    // 年龄
    private double age;

    // 学号
    private int quantity;

    /**
     *
     *
     * @param name     名字
     * @param age      年龄
     * @param quantity 学号
     */
    public HouseHold(String name, double age, int quantity) {
        this.name = name;
        this.age = age;
        this.quantity = quantity;
    }

    /**
     * 输出信息的方法
     */
    public void displayHouseHoldInfo() {
        System.out.println("名字: " + name + ", 年龄: " + age + ", 学号: " + quantity);
    }

    /**
     * 母鸡销售的方法
     */
    public void sellHouseHold() {
        Random random = new Random();
        int soldQuantity = random.nextInt(quantity);
        quantity -= soldQuantity;
        System.out.println("销售了 " + soldQuantity + " 只 母鸡");
    }

    public static void main(String[] args) {
        // 创建对象
        HouseHold houseHold = new HouseHold("户方耀", 18, 30);
        // 调用方法
        houseHold.displayHouseHoldInfo();
        houseHold.sellHouseHold();
    }
}

